import java.util.Stack;

public class StackTest {
    public static void main(String[] args) {
        //创建一个栈
        Stack<Integer> stack = new Stack<Integer>();
        //往里面存元素
        stack.push(10);
        stack.push(20);
        stack.push(30);
        stack.push(15);
        //取元素
        int x = stack.pop();
        System.out.println(x);
        //peek获取栈顶元素，但不删除
        int p = stack.peek();
        System.out.println(p);
        int p1 = stack.peek();
        System.out.println(p1);
    }
}
